package com.zheok.testing.excepiton;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import utils.R;

/**
 * 异常处理类
 * @author  li liang
 */
@ResponseBody
@ControllerAdvice
public class MyExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    public R exception(Exception e) {
        return R.error("程序发生异常，异常信息为："+e.getMessage());
    }
}
